package com.djl.mymall;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.OutputFile;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Generator {
    public static void main(String[] args) {
        List<String> list=new ArrayList<>();
        list.add("cms_help");
        list.add("cms_help_category");
        list.add("cms_member_report");
        list.add("cms_prefrence_area");
        list.add("cms_prefrence_area_product_relation");
        list.add("cms_subject");
        list.add("cms_subject_category");
        list.add("cms_subject_comment");
        list.add("cms_subject_product_relation");
        list.add("cms_topic");
        list.add("cms_topic_category");
        list.add("cms_topic_comment");
        list.add("oms_cart_item");
        list.add("oms_company_address");
        list.add("oms_order");
        list.add("oms_order_item");
        list.add("oms_order_operate_history");
        list.add("oms_order_return_apply");
        list.add("oms_order_return_reason");
        list.add("oms_order_setting");
        list.add("pms_album");
        list.add("pms_album_pic");
        list.add("pms_brand");
        list.add("pms_comment");
        list.add("pms_comment_replay");
        list.add("pms_feight_template");
        list.add("pms_member_price");
        list.add("pms_product");
        list.add("pms_product_attribute");
        list.add("pms_product_attribute_category");
        list.add("pms_product_attribute_value");
        list.add("pms_product_category");
        list.add("pms_product_category_attribute_relation");
        list.add("pms_product_full_reduction");
        list.add("pms_product_ladder");
        list.add("pms_product_operate_log");
        list.add("pms_product_vertify_record");
        list.add("pms_sku_stock");
        list.add("sms_coupon");
        list.add("sms_coupon_history");
        list.add("sms_coupon_product_category_relation");
        list.add("sms_coupon_product_relation");
        list.add("sms_flash_promotion");
        list.add("sms_flash_promotion_log");
        list.add("sms_flash_promotion_product_relation");
        list.add("sms_flash_promotion_session");
        list.add("sms_home_advertise");
        list.add("sms_home_brand");
        list.add("sms_home_new_product");
        list.add("sms_home_recommend_product");
        list.add("sms_home_recommend_subject");
        list.add("ums_admin");
        list.add("ums_admin_login_log");
        list.add("ums_admin_permission_relation");
        list.add("ums_admin_role_relation");
        list.add("ums_growth_change_history");
        list.add("ums_integration_change_history");
        list.add("ums_integration_consume_setting");
        list.add("ums_member");
        list.add("ums_member_level");
        list.add("ums_member_login_log");
        list.add("ums_member_member_tag_relation");
        list.add("ums_member_product_category_relation");
        list.add("ums_member_receive_address");
        list.add("ums_member_rule_setting");
        list.add("ums_member_statistics_info");
        list.add("ums_member_tag");
        list.add("ums_member_task");
        list.add("ums_menu");
        list.add("ums_permission");
        list.add("ums_resource");
        list.add("ums_resource_category");
        list.add("ums_role");
        list.add("ums_role_menu_relation");
        list.add("ums_role_permission_relation");
        list.add("ums_role_resource_relation");
        FastAutoGenerator.create("jdbc:mysql://localhost:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai", "root", "root")
                .globalConfig(builder -> {
                    builder.author("djl") // 设置作者
                            .enableSwagger() // 开启 swagger 模式
                            .fileOverride() // 覆盖已生成文件
                            .outputDir("D://戴金龙学习/java/demo/myMall/src/main/java/"); // 指定输出目录
                })
                .packageConfig(builder -> {
                    builder.parent("com.djl.mymall.mbg") // 设置父包名
                            .moduleName("") // 设置父包模块名
                            .pathInfo(Collections.singletonMap(OutputFile.mapperXml, "D://戴金龙学习/java/demo/myMall/src/main/resources/com/djl/mall/mapper")); // 设置mapperXml生成路径
                })
                .strategyConfig(builder -> {
                    builder.addInclude(list) // 设置需要生成的表名
                            .addTablePrefix("ums_", "sms_","pms_","oms","cms_"); // 设置过滤表前缀
                })
                .templateEngine(new FreemarkerTemplateEngine())// 使用Freemarker引擎模板，默认的是Velocity引擎模板

                .execute();

    }
}
